/*
 * Controller.cpp
 *
 *  Created on: 28 août 2014
 *      Author: Raphaël
 */
#include <QAbstractItemModel>
#include "Controller.h"
#include "uiTestSrc/view/View.h"

Controller::Controller
	(
	View *xPtrView,
	QAbstractItemModel *xPtrModel,
	QObject *xPtrParent
	):
    QObject(xPtrParent),
    m_ptrView(xPtrView),
    m_ptrModel(xPtrModel)
    {
    connect(m_ptrModel.get(), SIGNAL(dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight)),
	    m_ptrView.get(), SLOT(update(const QModelIndex & topLeft)));

    connect(m_ptrView.get(), SIGNAL(signalCancel(bool)), m_ptrModel.get(), SLOT(onCancelClicked(bool)));
    connect(m_ptrView.get(), SIGNAL(signalOk(bool)), m_ptrModel.get(), SLOT(onOkClicked(bool)));
    }

Controller::~Controller()
    {
    }

